package playn101.core;

import static playn.core.PlayN.*;

import playn.core.Game;
import playn.core.Image;
import playn.core.ImageLayer;
import playn.core.Canvas;
import playn.core.CanvasImage;

public class B implements Game {

  @Override
  public void init() {
    CanvasImage bgImage = graphics().createImage(800, 600);
    Canvas canvas = bgImage.canvas();
    canvas.setFillColor(0xff87ceeb);
    canvas.fillRect(0, 0, 800, 600);
    ImageLayer bgLayer = graphics().createImageLayer(bgImage);
    graphics().rootLayer().add(bgLayer);
    Image cloudImage = assetManager().getImage("images/cloud.png");
    ImageLayer cloudLayer = graphics().createImageLayer(cloudImage);
    graphics().rootLayer().add(cloudLayer);
    float x = 24.0f;
    float y = 3.0f;
    cloudLayer.setTranslation(x, y);
  }

  @Override
  public void paint(float alpha) {
    // the background automatically paints itself, so no need to do anything here!
  }

  @Override
  public void update(float delta) {
  }

  @Override
  public int updateRate() {
    return 25;
  }
}
